const arr = [null, null, undefined, undefined, NaN, NaN, Infinity, Infinity, {}, {}, [1], [1], function() { }, function() { },
];

function unique(array) {
  const res = [];
  for (var i = 0; i < array.length; i++) {
    if (!res.includes(array[i])) {
      res.push(array[i]);
    }
  }
  return res;
}

console.log(unique(arr));